<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS 函数对象</title>
</head>
<body>
<script>
    //---------------------------------函数对象------------------------------------------
    //    1.函数的创建
    function foo(a,b) {
        return a+b
    }
    console.log(foo(199,898,18,2154))
    //    2.函数的调用

    f('alex');
    function f(name) {
        console.log('hello:'+name)

    }

    function f1(x,y,z) {
        return x+y+z;
    }
    console.log(f1(1+8));  // NaN
    console.log(f1('hello','xiaogao:'));

    //   3.函数内置对象arguments

    function add(a,b) {
        var sum=0;
        for(var i=0;i<arguments.length;i++){
            sum+=arguments[i];
        }
        return sum;
    }
    console.log(add(199,898,18,2154,5,487,48,48,48,4854,548,1));
    //  4. 匿名函数(1)
    var fun =function (arg) {
        console.log(arg)
    };
    fun("朝辞白帝彩云间、千里江陵一日还。两岸猿声啼不住，轻舟已过万重山。");
    fun('朝发白帝城 唐：李白');



</script>
</body>
</html>